package com.kehao.account_book.repository;

import com.kehao.account_book.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author kehao
 * @date 2020/2/21-21:44
 */
public interface UserRepository extends JpaRepository<User,Integer> {
    public List<User> findByUsername(String username);

    @Modifying
    @Query("UPDATE User u SET u.password = ?1 WHERE u.username = ?2")
    void updateUserPassword(String password ,String username);

}
